home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / CADSP 1.0 / Demo / CATalkPane.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-04  |  1.4 KB  |  68 lines  |  [TEXT/KAHL]

  1. /****
  2.  * CATalkPane.c
  3.  *
  4.  *    Pane methods for a typical application.
  5.  *
  6.  *  Copyright © 1990 Symantec Corporation.  All rights reserved.
  7.  *
  8.  ****/
  9.  
  10.  #include <CScrollPane.h>
  11.  
  12. /**
  13.  *
  14.  *  Most applications will want a scrollable window, so this
  15.  *  class is based on the class CPanorama. All the methods here
  16.  *  would still apply to classes based directly on CPane.
  17.  *
  18.  **/
  19.  
  20. #include "CATalkPane.h"
  21.  
  22.  
  23. void CATalkPane::IATalkPane(CView *anEnclosure, CBureaucrat *aSupervisor,
  24.                             short aWidth, short aHeight,
  25.                             short aHEncl, short aVEncl,
  26.                             SizingOption aHSizing, SizingOption aVSizing)
  27. {
  28.     CPane::IPane(anEnclosure, aSupervisor, aWidth, aHeight,
  29.                             aHEncl, aVEncl, aHSizing, aVSizing);
  30.     
  31.     topPane = bottomPane = nil;
  32. }
  33.  
  34.  
  35. void CATalkPane::SetSubPanes(CPane *top, CPane *bottom)
  36. {
  37.     topPane = top;
  38.     bottomPane = bottom;
  39. }
  40.  
  41. /***
  42.  * ChangeSize
  43.  *
  44.  *        change the sizes of the two inner panes accordingly
  45.  ***/
  46. void CATalkPane::ChangeSize(Rect *delta, Boolean redraw)
  47. {
  48.     long vdif = delta->bottom - delta->top;
  49.     long halfv = vdif / 2;
  50.     Rect topdelta = *delta;
  51.     Rect bottomdelta = *delta;
  52.     
  53.     inherited::ChangeSize(delta, redraw);
  54.     
  55.     // these were taken care of in inherited::
  56.     topdelta.right = topdelta.left = 0;
  57.     bottomdelta.right = bottomdelta.left = 0;
  58.  
  59.     if (topPane && bottomPane)
  60.         {
  61.         topdelta.bottom = halfv;
  62.         bottomdelta.top = halfv;
  63.         bottomdelta.bottom = vdif;
  64.     
  65.         topPane->ChangeSize(&topdelta, redraw);
  66.         bottomPane->ChangeSize(&bottomdelta, redraw);
  67.         }
  68. }